# 翻转一棵二叉树。

# Definition for a binary tree node.
class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right
class Solution:
    def invertTree(self, root: TreeNode) -> TreeNode:
        if root == None:
            return None
        def deveser(root):
            if root == None:
                return
            deveser(root.left)
            deveser(root.right)
            temp = root.left
            root.left = root.right
            root.right = temp
        cur = root
        deveser(cur)
        return root